home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
cuj9303.zip
/
1103099A
< prev
next >
Wrap
Text File
|
1993-06-21
|
674b
|
32 lines
// tdate6.cpp:
#include <stdio.h>
#include "date6.h"
main()
{
Date d1(1,1,1970), d2(12,8,1992);
Date result = d1 - d2;
printf("years: %d, months: %d, days: %d\n",
result.get_year(),
result.get_month(),
result.get_day());
result = d2 - d1;
printf("years: %d, months: %d, days: %d\n",
result.get_year(),
result.get_month(),
result.get_day());
int test = d1 - d2 == -(d2 - d1);
printf("d1 - d2 == -(d2 - d1)? %s\n",
test ? "yes" : "no");
return 0;
}
/* OUTPUT
years: -22, months: -11, days: -7
years: 22, months: 11, days: 7
d1 - d2 == -(d2 - d1)? yes
*/